package com.model.dao;

// Generated Sep 16, 2013 2:49:26 PM by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * OrderTable generated by hbm2java
 */
@Entity
@Table(name = "order_table", catalog = "shoppingcart_schema")
public class OrderTable implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7745196832289165711L;
	private int orderId;
	private UserTable userTable;
	private GuestTable guestTable;
	private String price;
	private String orderStatus;
	private Date dateOfOrder;
	private Date dateOfDelivery;
	private String orderType;
	private Set<OrderItemsTable> orderItemsTables = new HashSet<OrderItemsTable>(
			0);

	public OrderTable() {
	}

	public OrderTable(int orderId, UserTable userTable) {
		this.orderId = orderId;
		this.userTable = userTable;
	}

	public OrderTable(int orderId, UserTable userTable,GuestTable guestTable, String price,
			String orderStatus, Date dateOfOrder, Date dateOfDelivery, String orderType,
			Set<OrderItemsTable> orderItemsTables) {
		this.orderId = orderId;
		this.userTable = userTable;
		this.guestTable = guestTable;
		this.price = price;
		this.orderStatus = orderStatus;
		this.dateOfOrder = dateOfOrder;
		this.dateOfDelivery = dateOfDelivery;
		this.orderType = orderType;
		this.orderItemsTables = orderItemsTables;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "orderId", unique = true, nullable = false)
	public int getOrderId() {
		return this.orderId;
	}

	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "user_Id")
	public UserTable getUserTable() {
		return this.userTable;
	}

	public void setUserTable(UserTable userTable) {
		this.userTable = userTable;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "guest_Id")
	public GuestTable getGuestTable() {
		return this.guestTable;
	}

	public void setGuestTable(GuestTable guestTable) {
		this.guestTable = guestTable;
	}

	@Column(name = "price", length = 45)
	public String getPrice() {
		return this.price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	@Column(name = "orderStatus", length = 45)
	public String getOrderStatus() {
		return this.orderStatus;
	}

	public void setOrderStatus(String orderStatus) {
		this.orderStatus = orderStatus;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "dateOfOrder", length = 0)
	public Date getDateOfOrder() {
		return this.dateOfOrder;
	}

	public void setDateOfOrder(Date dateOfOrder) {
		this.dateOfOrder = dateOfOrder;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "dateOfDelivery", length = 0)
	public Date getDateOfDelivery() {
		return this.dateOfDelivery;
	}

	public void setDateOfDelivery(Date dateOfDelivery) {
		this.dateOfDelivery = dateOfDelivery;
	}

	@Column(name = "orderType", nullable = false, length = 1)
	public String getOrderType() {
		return this.orderType;
	}

	public void setOrderType(String orderType) {
		this.orderType = orderType;
	}
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "orderTable",orphanRemoval=true,cascade=CascadeType.ALL)
	public Set<OrderItemsTable> getOrderItemsTables() {
		return this.orderItemsTables;
	}

	public void setOrderItemsTables(Set<OrderItemsTable> orderItemsTables) {
		this.orderItemsTables = orderItemsTables;
	}

}
